home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
VideoFolder 1.0a
/
Source
/
MoreFiles 1.4.1
/
MoreFilesExtras.p
< prev
next >
Wrap
Text File
|
1995-12-21
|
64KB
|
1,613 lines
UNIT MoreFilesExtras;
{ Apple Macintosh Developer Technical Support }
{ }
{ A collection of useful high-level File Manager routines. }
{ by Jim Luther, Apple Developer Technical Support Emeritus }
{ }
{ File: MoreFilesExtras.p }
{ }
{ Copyright © 1992-1995 Apple Computer, Inc. }
{ All rights reserved. }
{ }
{ You may incorporate this sample code into your applications without }
{ restriction, though the sample code has been provided "AS IS" and the }
{ responsibility for its operation is 100% yours. However, what you are }
{ not permitted to do is to redistribute the source as "DSC Sample Code" }
{ after having made changes. If you're going to re-distribute the source, }
{ we require that you make it clear in the source that the code was }
{ descended from Apple Sample Code, but that you've made changes. }
INTERFACE
USES
Files;
{ Deny mode permissions for use with the HOpenAware, HOpenRFAware, }
{ FSpOpenAware, and FSpOpenRFAware functions. }
CONST
dmNone = $0000;
dmNoneDenyRd = $0010;
dmNoneDenyWr = $0020;
dmNoneDenyRdWr = $0030;
dmRd = $0001; { Single writer, multiple readers; the readers }
dmRdDenyRd = $0011;
dmRdDenyWr = $0021; { Browsing - equivalent to fsRdPerm }
dmRdDenyRdWr = $0031;
dmWr = $0002;
dmWrDenyRd = $0012;
dmWrDenyWr = $0022;
dmWrDenyRdWr = $0032;
dmRdWr = $0003; { Shared access - equivalent to fsRdWrShPerm }
dmRdWrDenyRd = $0013;
dmRdWrDenyWr = $0023; { Single writer, multiple readers; the writer }
dmRdWrDenyRdWr = $0033; { Exclusive access - equivalent to fsRdWrPerm }
{ For those times where you need to use more than one kind of }
{ File Manager parameter block but don't feel like wasting stack space, }
{ here's a parameter block you can reuse. }
{$PUSH}
{$ALIGN MAC68K}
TYPE
UniversalFMPBHandle = ^UniversalFMPBPtr;
UniversalFMPBPtr = ^UniversalFMPB;
UniversalFMPB = RECORD
CASE Integer OF
1: (
PB: ParamBlockRec
);
2: (
ciPB: CInfoPBRec
);
3: (
dtPB: DTPBRec
);
4: (
hPB: HParamBlockRec
);
5: (
cmPB: CMovePBRec
);
6: (
wdPB: WDPBRec
);
7: (
fcbPB: FCBPBRec
);
END;
{ Used by GetUGEntries to return user or group lists. }
UGEntryHandle = ^UGEntryPtr;
UGEntryPtr = ^UGEntry;
UGEntry = RECORD
objType: Integer;
objID: LongInt;
name: Str31;
END;
{ I use the following record instead of the AFPVolMountInfo structure }
{ in Files.p }
Str8 = STRING[8];
MyAFPVolMountInfoHandle = ^MyAFPVolMountInfoPtr;
MyAFPVolMountInfoPtr = ^MyAFPVolMountInfo;
MyAFPVolMountInfo = RECORD
length: Integer; { length of this record }
media: VolumeType; { type of media, always AppleShareMediaType }
flags: Integer; { 0 = normal mount; set bit 0 to inhibit greeting messages }
nbpInterval: SignedByte; { NBP interval parameter; 7 is a good choice }
nbpCount: SignedByte; { NBP count parameter; 5 is a good choice }
uamType: Integer; { User Authentication Method }
zoneNameOffset: Integer; { offset from start of record to zoneName }
serverNameOffset: Integer; { offset from start of record to serverName }
volNameOffset: Integer; { offset from start of record to volName }
userNameOffset: Integer; { offset from start of record to userName }
userPasswordOffset: Integer; { offset from start of record to userPassword }
volPasswordOffset: Integer; { offset from start of record to volPassword }
zoneName: Str31; { server's AppleTalk zone name }
serverName: Str31; { server name }
volName: Str27; { volume name }
userName: Str31; { user name (zero length Pascal string for guest) }
userPassword: Str8; { user password (zero length Pascal string if no user password) }
volPassword: Str8; { volume password (zero length Pascal string if no volume password) }
END;
{$ALIGN RESET}
{$POP}
{***************************************************************************}
{ Functions to get information out of GetVolParmsInfoBuffer (implemented }
{ in this Unit). }
FUNCTION isNetworkVolume (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasLimitFCBs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasLocalWList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasNoMiniFndr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasNoVNEdit (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasNoLclSync (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasTrshOffLine (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasNoSwitchTo (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasNoDeskItems (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasNoBootBlks (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasAccessCntl (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasNoSysDir (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasExtFSVol (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasOpenDeny (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasCopyFile (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasMoveRename (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasDesktopMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasShortName (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasFolderLock (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasPersonalAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasUserGroupList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasCatSearch (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasFileIDs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasBTreeMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
FUNCTION hasBlankAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
{***************************************************************************}
FUNCTION GetTempBuffer (buffReqSize: LONGINT;
VAR buffActSize: LONGINT): Ptr;
{ Allocate a temporary copy or search buffer.}
{{ The GetTempBuffer function allocates a temporary buffer for file system }
{ operations which is at least 1024 bytes (1K) and a multiple of }
{ 1024 bytes. }
{ }
{ buffReqSize input: Size you'd like the buffer to be. }
{ buffActSize output: Size of buffer allocated. }
{ function result output: Pointer to memory allocated or nil if no memory }
{ was available. The caller is responsible for }
{ disposing of this buffer with DisposePtr. }
{***************************************************************************}
FUNCTION DetermineVRefNum (pathname: StringPtr;
vRefNum: Integer;
VAR realVRefNum: Integer): OSErr;
{ Use DetermineVRefNum to determine the volume reference number of a }
{ volume from a pathname, a volume specification, or a combination }
{ of the two. }
{ WARNING: Volume names on the Macintosh are *not* unique -- Multiple }
{ mounted volumes can have the same name. For this reason, the use of a }
{ volume name or full pathname to identify a specific volume may not }
{ produce the results you expect. If more than one volume has the same }
{ name and a volume name or full pathname is used, the File Manager }
{ currently uses the first volume it finds with a matching name in the }
{ volume queue. }
{ }
{ pathName input: Pointer to a full pathname or nil. If you pass in }
{ a partial pathname, it is ignored. A full pathname }
{ to a volume must end with a colon character (:). }
{ vRefNum input: Volume specification (volume reference number, }
{ working directory number, drive number, or 0). }
{ realVRefNum output: The real volume reference number. }
{***************************************************************************}
FUNCTION HGetVInfo (volReference: Integer;
volName: StringPtr;
VAR vRefNum: Integer;
VAR freeBytes: LongInt;
VAR totalBytes: LongInt): OSErr;
{ The HGetVInfo function returns the name, volume reference number, }
{ available space (in bytes), and total space (in bytes) for the }
{ specified volume. You can specify the volume by providing its drive }
{ number, volume reference number, or 0 for the default volume. }
{ This routine is compatible with volumes up to 4 gigabytes. }
{ }
{ volReference input: The drive number, volume reference number, }
{ or 0 for the default volume. }
{ volName input: A pointer to a buffer (minimum Str27) where }
{ the volume name is to be returned or must }
{ be nil. }
{ output: The volume name. }
{ vRefNum output: The volume reference number. }
{ freeBytes output: The number of free bytes on the volume. }
{ freeBytes is an UNSIGNED long value. }
{ totalBytes output: The total number of bytes on the volume. }
{ totalBytes is an UNSIGNED long value. }
{***************************************************************************}
FUNCTION XGetVInfo (volReference: Integer;
volName: StringPtr;
VAR vRefNum: Integer;
VAR freeBytes: UnsignedWide;
VAR totalBytes: UnsignedWide): OSErr;
{ The XGetVInfo function returns the name, volume reference number, }
{ available space (in bytes), and total space (in bytes) for the }
{ specified volume. You can specify the volume by providing its drive }
{ number, volume reference number, or 0 for the default volume. }
{ This routine is compatible with volumes up to 2 terabytes. }
{ }
{ volReference input: The drive number, volume reference number, }
{ or 0 for the default volume. }
{ volName input: A pointer to a buffer (minimum Str27) where }
{ the volume name is to be returned or must }
{ be nil. }
{ output: The volume name. }
{ vRefNum output: The volume reference number. }
{ freeBytes output: The number of free bytes on the volume. }
{ freeBytes is an UnsignedWide value. }
{ totalBytes output: The total number of bytes on the volume. }
{ totalBytes is an UnsignedWide value. }
{***************************************************************************}
FUNCTION CheckVolLock (pathname: StringPtr;
vRefNum: Integer): OSErr;
{ Use CheckVolLock to determine if a volume is locked - either by }
{ hardware or by software. If CheckVolLock returns noErr, then the volume }
{ is not locked. }
{ }
{ pathName input: Pointer to a full pathname or nil. If you pass in }
{ a partial pathname, it is ignored. A full pathname }
{ to a volume must end with a colon character (:). }
{ vRefNum input: Volume specification (volume reference number, }
{ working directory number, drive number, or 0). }
{***************************************************************************}
FUNCTION GetDriverName (driverRefNum: Integer;
VAR driverName: Str255): OSErr;
{ Get a device driver's name. }
{ The GetDriverName function returns a device driver's name. }
{ }
{ driverRefNum input: The driver reference number. }
{ driverName output: The driver's name. }
{***************************************************************************}
FUNCTION FindDrive (pathname: StringPtr;
vRefNum: Integer;
VAR driveQElementPtr: DrvQElPtr): OSErr;
{ Find a volume's drive queue element in the drive queue. }
{ The FindDrive function returns a pointer to a mounted volume's }
{ drive queue element. }
{ }
{ pathName input: Pointer to a full pathname or nil. If you }
{ pass in a partial pathname, it is ignored. }
{ A full pathname to a volume must end with }
{ a colon character (:). }
{ vRefNum input: Volume specification (volume reference }
{ number, working directory number, drive }
{ number, or 0). }
{ driveQElementPtr output: Pointer to a volume's drive queue element }
{ in the drive queue. DO NOT change the }
{ DrvQEl. }
{***************************************************************************}
FUNCTION UnmountAndEject (pathname: StringPtr;
vRefNum: Integer): OSErr;
{ Use UnmountAndEject to unmount and eject a volume. The volume is }
{ ejected only if it's ejectable and not already ejected. }
{ }
{ pathName input: Pointer to a full pathname or nil. If you pass in }
{ a partial pathname, it is ignored. A full pathname }
{ to a volume must end with a colon character (:). }
{ vRefNum input: Volume specification (volume reference number, }
{ workingdirectory number, drive number, or 0). }
{***************************************************************************}
FUNCTION OnLine (volumes: FSSpecPtr;
reqVolCount: Integer;
VAR actVolCount: Integer;
VAR volIndex: Integer): OSErr;
{ Use OnLine to return the list of volumes currently mounted. }
{ }
{ volumes input: Pointer to array of FSSpec where the volume list }
{ is returned. }
{ reqVolCount input: Maximum number of volumes to return (the number of }
{ elements in the volumes array). }
{ actVolCount output: The number of volumes actually returned. }
{ volIndex input: The current volume index position. Set to 1 to }
{ start with the first volume. }
{ output: The volume index position to get the next volume. }
{ Pass this value the next time you call OnLine to }
{ start where you left off. }
{***************************************************************************}
FUNCTION SetDefault (newVRefNum: Integer;
newDirID: LongInt;
VAR oldVRefNum: Integer;
VAR oldDirID: LongInt): OSErr;
{ Set the default volume before making Standard I/O requests. }
{ The SetDefault function sets the default volume and directory to the }
{ volume specified by newVRefNum and the directory specified by newDirID. }
{ The current default volume reference number and directory ID are }
{ returned in oldVRefNum and oldDir and must be used to restore the }
{ default volume and directory to their previous state *as soon as }
{ possible* with the RestoreDefault function. These two functions are }
{ designed to be used as a wrapper around Standard I/O routines where }
{ the location of the file is implied to be the default volume and }
{ directory. In other words, this is how you should use these functions: }
{ }
{ error := SetDefault(newVRefNum, newDirID, oldVRefNum, oldDirID); }
{ IF ( error = noErr ) THEN }
{ BEGIN }
{ -- call the Standard I/O requests like Open, Reset and -- }
{ -- Rewrite here! -- }
{ }
{ error := RestoreDefault(oldVRefNum, oldDirID); }
{ END; }
{ }
{ By using these functions as a wrapper, you won't need to open a working }
{ directory (because SetDefault and RestoreDefault use HSetVol) and you }
{ won't have to worry about the effects of using HSetVol (documented in }
{ Technical Note "FL 11 - PBHSetVol is Dangerous" and in the }
{ Inside Macintosh: Files book in the description of the HSetVol and }
{ PBHSetVol functions) because the default volume/directory is restored }
{ before giving up control to code that might be affected by HSetVol. }
{ }
{ newVRefNum input: Volume specification (volume reference number, }
{ working directory number, drive number, or 0) of }
{ the new default volume. }
{ newDirID input: Directory ID of the new default directory. }
{ oldVRefNum output: The volume specification to save for use with }
{ RestoreDefault. }
{ oldDirID output: The directory ID to save for use with }
{ RestoreDefault. }
{***************************************************************************}
FUNCTION RestoreDefault (oldVRefNum: Integer;
oldDirID: LongInt): OSErr;
{ Restore the default volume after making Standard I/O requests. }
{ The RestoreDefault function restores the default volume and directory }
{ to the volume specified by oldVRefNum and the directory specified by }
{ oldDirID. The oldVRefNum and oldDirID parameters were previously }
{ obtained from the SetDefault function. These two functions are designed }
{ to be used as a wrapper around Standard I/O routines where the }
{ location of the file is implied to be the default volume and directory. }
{ In other words, this is how you should use these functions: }
{ }
{ error := SetDefault(newVRefNum, newDirID, oldVRefNum, oldDirID); }
{ IF ( error = noErr ) THEN }
{ BEGIN }
{ -- call the Standard I/O requests like Open, Reset and -- }
{ -- Rewrite here! -- }
{ }
{ error := RestoreDefault(oldVRefNum, oldDirID); }
{ END; }
{ }
{ By using these functions as a wrapper, you won't need to open a working }
{ directory (because SetDefault and RestoreDefault use HSetVol) and you }
{ won't have to worry about the effects of using HSetVol (documented in }
{ Technical Note "FL 11 - PBHSetVol is Dangerous" and in the }
{ Inside Macintosh: Files book in the description of the HSetVol and }
{ PBHSetVol functions) because the default volume/directory is restored }
{ before giving up control to code that might be affected by HSetVol. }
{ }
{ oldVRefNum input: The volume specification to restore. }
{ oldDirID input: The directory ID to restore. }
{***************************************************************************}
FUNCTION GetDInfo (vRefNum: Integer;
dirID: LongInt;
name: StringPtr;
VAR fndrInfo: DInfo): OSErr;
{ Use GetDInfo to get the finder information for a directory. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID }
{ specifies a directory that's the object. }
{ fndrInfo output: If the object is a directory, then its DInfo. }
{***************************************************************************}
FUNCTION FSpGetDInfo ({CONST}
VAR spec: FSSpec;
VAR fndrInfo: DInfo): OSErr;
{ Use FSpGetDInfo to get the finder information for a directory. }
{ }
{ spec input: An FSSpec record specifying the directory. }
{ fndrInfo output: If the object is a directory, then its DInfo. }
{***************************************************************************}
FUNCTION SetDInfo (vRefNum: Integer;
dirID: LongInt;
name: StringPtr;
fndrInfo: DInfo): OSErr;
{ Use SetDInfo to Set the finder information for a directory. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID }
{ specifies a directory that's the object. }
{ fndrInfo output: The DInfo. }
{***************************************************************************}
FUNCTION FSpSetDInfo ({CONST}
VAR spec: FSSpec;
fndrInfo: DInfo): OSErr;
{ Use FSpSetDInfo to set the finder information for a directory. }
{ }
{ spec input: An FSSpec record specifying the directory. }
{ fndrInfo input: The DInfo. }
{***************************************************************************}
FUNCTION GetDirectoryID (vRefNum: Integer;
dirID: LongInt;
name: StringPtr;
VAR theDirID: LongInt;
VAR isDirectory: Boolean): OSErr;
{ Use GetDirectoryID to get the directory ID number of the directory }
{ specified. If a file is specified, then the parent }
{ directory of the file is returned and isDirectory is false. If }
{ a directory is specified, then that directory's ID number is }
{ returned and isDirectory is true. }
{ WARNING: Volume names on the Macintosh are *not* unique -- Multiple }
{ mounted volumes can have the same name. For this reason, the use of a }
{ volume name or full pathname to identify a specific volume may not }
{ produce the results you expect. If more than one volume has the same }
{ name and a volume name or full pathname is used, the File Manager }
{ currently uses the first volume it finds with a matching name in the }
{ volume queue. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID }
{ specifies a directory that's the object. }
{ theDirID output: If the object is a file, then its parent }
{ directory ID. If the object is a directory, }
{ then its ID. }
{ isDirectory output: True if object is a directory; false if }
{ object is a file. }
{***************************************************************************}
FUNCTION FSpGetDirectoryID ({CONST}
VAR spec: FSSpec;
VAR theDirID: LongInt;
VAR isDirectory: Boolean): OSErr;
{ Use DirIDFromFSSpec to get the directory ID number of the directory }
{ specified by spec. If spec is to a file, then the parent }
{ directory of the file is returned and isDirectory is false. If }
{ spec is to a directory, then that directory's ID number is }
{ returned and isDirectory is true. }
{ }
{ spec input: An FSSpec record specifying the directory. }
{ theDirID output: The directory ID. }
{ isDirectory output: True if object is a directory; false if }
{ object is a file. }
{***************************************************************************}
FUNCTION GetDirName (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use GetDirName to get the name of a directory from its directory ID. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name output: Points to a buffer (minimum Str63) where the }
{ directory name is to be returned or must be nil. }
{***************************************************************************}
FUNCTION GetParentID (vRefNum: Integer;
dirID: LongInt;
name: StringPtr;
VAR parID: LongInt): OSErr;
{ Use GetParentID to get the parent directory ID number of the specified }
{ object. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{ parID output: The parent directory ID of the specified object. }
{***************************************************************************}
FUNCTION GetFilenameFromPathname (pathname: Str255;
VAR filename: Str255): OSErr;
{ Use GetFilenameFromPathname to get the file (or directory) name from }
{ the end of a full or partial pathname. Returns notAFileErr if the }
{ pathname is nil, the pathname is empty, or the pathname cannot refer to }
{ a filename (with a noErr result, the pathname could still refer to a }
{ directory). GetFilenameFromPathname is used by GetObjectLocation. }
{ }
{ pathname input: A full or partial pathname. }
{ filename output: The file (or directory) name. }
{***************************************************************************}
FUNCTION GetObjectLocation (vRefNum: Integer;
dirID: LongInt;
pathname: StringPtr;
VAR realVRefNum: Integer;
VAR realParID: LongInt;
VAR realName: Str255;
VAR isDirectory: Boolean): OSErr;
{ Use GetObjectLocation to get a file system object's location - that is, }
{ its real volume reference number, real parent directory ID, and name. }
{ While we're at it, determine if the object is a file or directory. }
{ If GetObjectLocation returns fnfErr, then the location information }
{ returned is valid, but it describes an object that doesn't exist. }
{ You can use the location information for another operation, such as }
{ creating a file or directory. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ pathname input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{ realVRefNum output: The real volume reference number. }
{ realParID output: The parent directory ID of the specified object. }
{ realName output: The name of the specified object (the case of the }
{ object name may not be the same as the object's }
{ catalog entry on disk - since the Macintosh file }
{ system is not case sensitive, it shouldn't matter). }
{ isDirectory output: True if object is a directory; false if object }
{ is a file. }
{***************************************************************************}
FUNCTION GetDirItems (vRefNum: Integer;
dirID: LongInt;
name: StringPtr;
getFiles: Boolean;
getDirectories: Boolean;
items: FSSpecPtr;
reqItemCount: Integer;
VAR actItemCount: Integer;
VAR itemIndex: Integer): OSErr;
{ Use GetDirItems to return a list of items in a directory. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID }
{ specifies a directory that's the object. }
{ getFiles input: Pass true to have files added to the items list.}
{ getDirectories input: Pass true to have directories added to the }
{ items list. }
{ items input: Pointer to array of FSSpec where the item list }
{ is returned. }
{ reqItemCount input: Maximum number of items to return (the number }
{ of elements in the items array). }
{ actItemCount output: The number of volumes actually returned. }
{ itemIndex input: The current item index position. Set to 1 to }
{ start with the first item in the directory. }
{ output: The item index position to get the next item. }
{ Pass this value the next time you call }
{ GetDirItems to start where you left off. }
{***************************************************************************}
FUNCTION DeleteDirectoryContents (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ The DeleteDirectoryContents function deletes the contents of a }
{ directory. All files and subdirectories in the specified directory are }
{ deleted. If a locked file or directory is encountered, it is unlocked }
{ and then deleted. If any unexpected errors are encountered, }
{ DeleteDirectoryContents quits and returns to the caller. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to directory name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION DeleteDirectory (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ The DeleteDirectory function deletes a directory and its contents. }
{ All files and subdirectories in the specified directory are deleted. }
{ If a locked file or directory is encountered, it is unlocked and then }
{ deleted. After deleting the directories contents, the directory is }
{ deleted. If any unexpected errors are encountered, DeleteDirectory }
{ quits and returns to the caller. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to directory name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION CheckObjectLock (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use CheckObjectLock to determine if a file or directory is locked. }
{ If CheckObjectLock returns noErr, then the file or directory }
{ is not locked. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpCheckObjectLock ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpCheckObjectLock to determine if a file or directory is locked. }
{ If FSpCheckObjectLock returns noErr, then the file or directory }
{ is not locked. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION GetFileSize (vRefNum: Integer;
dirID: LongInt;
fileName: Str255;
VAR dataSize: LONGINT;
VAR rsrcSize: LONGINT): OSErr;
{ Get the logical sizes of a file's forks. }
{ The GetFileSize function returns the logical size of a file's }
{ data and resource fork. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: The name of the file. }
{ dataSize output: The number of bytes in the file's data fork. }
{ rsrcSize output: The number of bytes in the file's resource fork. }
{***************************************************************************}
FUNCTION FSpGetFileSize ({CONST}
VAR spec: FSSpec;
VAR dataSize: LONGINT;
VAR rsrcSize: LONGINT): OSErr;
{ Get the logical sizes of a file's forks. }
{ The FSpGetFileSize function returns the logical size of a file's }
{ data and resource fork. }
{ }
{ spec input: An FSSpec record specifying the file. }
{ dataSize output: The number of bytes in the file's data fork. }
{ rsrcSize output: The number of bytes in the file's resource fork. }
{***************************************************************************}
FUNCTION BumpDate (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use BumpDate to change the modification date of a file or directory to }
{ the current date/time. If the modification date is already equal to }
{ the current date/time, then add one second to the modification date. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpBumpDate ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpBumpDate to change the modification date of a file or directory }
{ to the current date/time. If the modification date is already equal }
{ to the current date/time, then add one second to the modification date. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION ChangeCreatorType (vRefNum: Integer;
dirID: LongInt;
name: Str255;
creator: OSType;
fileType: OSType): OSErr;
{ Use ChangeCreatorType to change the creator or file type of a file. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: The name of the file. }
{ creator input: The new creator type or 0x00000000 to leave }
{ the creator type alone. }
{ fileType input: The new file type or 0x00000000 to leave the }
{ file type alone. }
{***************************************************************************}
FUNCTION FSpChangeCreatorType ({CONST}
VAR spec: FSSpec;
creator: OSType;
fileType: OSType): OSErr;
{ Use FSpChangeCreatorType to change the creator or file type of a file. }
{ }
{ spec input: An FSSpec record specifying the file. }
{ creator input: The new creator type or 0x00000000 to leave }
{ the creator type alone. }
{ fileType input: The new file type or 0x00000000 to leave the }
{ file type alone. }
{***************************************************************************}
FUNCTION ChangeFDFlags (vRefNum: Integer;
dirID: LongInt;
name: StringPtr;
setBits: Boolean;
flagBits: Integer): OSErr;
{ Use ChangeFDFlags to set or clear Finder Flag bits in the fdFlags field }
{ of a file or directory's FInfo record. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{ setBits input: If true, then set the bits specified in flagBits. }
{ If false, then clear the bits specified in flagBits.}
{ flagBits input: The flagBits parameter specifies which Finder Flag }
{ bits to set or clear. If a bit in flagBits is set, }
{ then the same bit in fdFlags is either set or }
{ cleared depending on the state of the setBits }
{ parameter. }
{***************************************************************************}
FUNCTION FSpChangeFDFlags ({CONST}
VAR spec: FSSpec;
setBits: Boolean;
flagBits: Integer): OSErr;
{ Use FSpChangeFDFlags to set or clear Finder Flag bits in the fdFlags }
{ field of a file or directory's FInfo record. }
{ }
{ spec input: An FSSpec record specifying the object. }
{ setBits input: If true, then set the bits specified in flagBits. }
{ If false, then clear the bits specified in flagBits.}
{ flagBits input: The flagBits parameter specifies which Finder Flag }
{ bits to set or clear. If a bit in flagBits is set, }
{ then the same bit in fdFlags is either set or }
{ cleared depending on the state of the setBits }
{ parameter. }
{***************************************************************************}
FUNCTION SetIsInvisible (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use SetIsInvisible to set the invisible bit in the fdFlags word of the }
{ specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpSetIsInvisible ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpSetIsInvisible to set the invisible bit in the fdFlags word of }
{ the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION ClearIsInvisible (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use ClearIsInvisible to clear the invisible bit in the fdFlags word of }
{ the specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpClearIsInvisible ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpClearIsInvisible to clear the invisible bit in the fdFlags word }
{ of the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION SetNameLocked (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use SetNameLocked to set the nameLocked bit in the fdFlags word of the }
{ specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpSetNameLocked ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpSetNameLocked to set the nameLocked bit in the fdFlags word of }
{ the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION ClearNameLocked (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use ClearNameLocked to clear the nameLocked bit in the fdFlags word of }
{ the specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpClearNameLocked ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpClearNameLocked to clear the nameLocked bit in the fdFlags word }
{ of the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION SetIsStationery (vRefNum: Integer;
dirID: LongInt;
name: Str255): OSErr;
{ Use SetIsStationery to set the isStationery bit in the fdFlags word }
{ of the specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpSetIsStationery ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpSetIsStationery to set the isStationery bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION ClearIsStationery (vRefNum: Integer;
dirID: LongInt;
name: Str255): OSErr;
{ Use ClearIsStationery to clear the isStationery bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpClearIsStationery ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpClearIsStationery to clear the isStationery bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION SetHasCustomIcon (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use SetHasCustomIcon to set the hasCustomIcon bit in the fdFlags word }
{ of the specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpSetHasCustomIcon ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpSetHasCustomIcon to set the hasCustomIcon bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION ClearHasCustomIcon (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use ClearHasCustomIcon to clear the hasCustomIcon bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpClearHasCustomIcon ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpClearHasCustomIcon to clear the hasCustomIcon bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION ClearHasBeenInited (vRefNum: Integer;
dirID: LongInt;
name: StringPtr): OSErr;
{ Use ClearHasBeenInited to clear the hasBeenInited bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ name input: Pointer to object name, or nil when dirID specifies }
{ a directory that's the object. }
{***************************************************************************}
FUNCTION FSpClearHasBeenInited ({CONST}
VAR spec: FSSpec): OSErr;
{ Use FSpClearHasBeenInited to clear the hasBeenInited bit in the fdFlags }
{ word of the specified file or directory's finder information. }
{ }
{ spec input: An FSSpec record specifying the object. }
{***************************************************************************}
FUNCTION CopyFileMgrAttributes (srcVRefNum: Integer;
srcDirID: LongInt;
srcName: StringPtr;
dstVRefNum: Integer;
dstDirID: LongInt;
dstName: StringPtr;
copyLockBit: Boolean): OSErr;
{ Use CopyFileMgrAttributes to copy all File Manager attributes from the }
{ source file or directory to the destination file or directory. }
{ If copyLockBit is true, then set the locked state of the destination }
{ to match the source. }
{ }
{ srcVRefNum input: Source volume specification. }
{ srcDirID input: Source directory ID. }
{ srcName input: Pointer to source object name, or nil when }
{ srcDirID specifies a directory that's the object. }
{ dstVRefNum input: Destination volume specification. }
{ dstDirID input: Destination directory ID. }
{ dstName input: Pointer to destination object name, or nil when }
{ dstDirID specifies a directory that's the object. }
{ copyLockBit input: If true, set the locked state of the destination }
{ to match the source. }
{***************************************************************************}
FUNCTION FSpCopyFileMgrAttributes ({CONST}
VAR srcSpec: FSSpec;
{CONST}
VAR dstSpec: FSSpec;
copyLockBit: Boolean): OSErr;
{ Use FSpCopyFileMgrAttributes to copy all File Manager attributes from }
{ the source file or directory to the destination file or directory. }
{ If copyLockBit is true, then set the locked state of the destination }
{ to match the source. }
{ }
{ srcSpec input: An FSSpec record specifying the source object. }
{ dstSpec input: An FSSpec record specifying the destination object. }
{ copyLockBit input: If true, set the locked state of the destination }
{ to match the source. }
{***************************************************************************}
FUNCTION HOpenAware (vRefNum: Integer;
dirID: LongInt;
fileName: Str255;
denyModes: Integer;
VAR refNum: Integer): OSErr;
{ Use HOpenAware to open the data fork of a file using deny mode }
{ permissions instead the normal File Manager permissions. If OpenDeny }
{ is not available, then HOpenAware translates the deny modes to the }
{ closest File Manager permissions and tries to open the file with }
{ OpenDF first, and then Open if OpenDF isn't available. By using }
{ HOpenAware with deny mode permissions, a program can be "AppleShare }
{ aware" and fall back on the standard File Manager open calls }
{ automatically. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ fileName input: The name of the file. }
{ denyModes input: The deny modes access under which to open the file. }
{ refNum output: The file reference number of the opened file. }
{***************************************************************************}
FUNCTION FSpOpenAware ({CONST}
VAR spec: FSSpec;
denyModes: Integer;
VAR refNum: Integer): OSErr;
{ Use FSpOpenAware to open the data fork of a file using deny mode }
{ permissions instead the normal File Manager permissions. If OpenDeny }
{ is not available, then FSpOpenAware translates the deny modes to the }
{ closest File Manager permissions and tries to open the file with }
{ OpenDF first, and then Open if OpenDF isn't available. By using }
{ FSpOpenAware with deny mode permissions, a program can be "AppleShare }
{ aware" and fall back on the standard File Manager open calls }
{ automatically. }
{ }
{ spec input: An FSSpec record specifying the file. }
{ denyModes input: The deny modes access under which to open the file. }
{ refNum output: The file reference number of the opened file. }
{***************************************************************************}
FUNCTION HOpenRFAware (vRefNum: Integer;
dirID: LongInt;
fileName: Str255;
denyModes: Integer;
VAR refNum: Integer): OSErr;
{ Use HOpenRFAware to open the resource fork of a file using deny mode }
{ permissions instead the normal File Manager permissions. If OpenRFDeny }
{ is not available, then HOpenRFAware translates the deny modes to the }
{ closest File Manager permissions and tries to open the file with }
{ OpenRF. By using HOpenRFAware with deny mode permissions, a program }
{ can be "AppleShare aware" and fall back on the standard File Manager }
{ open calls automatically. }
{ }
{ vRefNum input: Volume specification. }
{ dirID input: Directory ID. }
{ fileName input: The name of the file. }
{ denyModes input: The deny modes access under which to open the file. }
{ refNum output: The file reference number of the opened file. }
{***************************************************************************}
FUNCTION FSpOpenRFAware ({CONST}
VAR spec: FSSpec;
denyModes: Integer;
VAR refNum: Integer): OSErr;
{ Use FSpOpenRFAware to open the resource fork of a file using deny mode }
{ permissions instead the normal File Manager permissions. If OpenRFDeny }
{ is not available, then FSpOpenRFAware translates the deny modes to the }
{ closest File Manager permissions and tries to open the file with }
{ OpenRF. By using FSpOpenRFAware with deny mode permissions, a program }
{ can be "AppleShare aware" and fall back on the standard File Manager }
{ open calls automatically. }
{ }
{ spec input: An FSSpec record specifying the file. }
{ denyModes input: The deny modes access under which to open the file. }
{ refNum output: The file reference number of the opened file. }
{***************************************************************************}
FUNCTION FSReadNoCache (refNum: Integer;
VAR count: LongInt;
buffPtr: Ptr): OSErr;
{ Use FSReadNoCache to read any number of bytes from an open file while }
{ asking the file system to bypass its cache mechanism. }
{ }
{ refNum input: The file reference number of an open file. }
{ count input: The number of bytes to read. }
{ output: The number of bytes actually read. }
{ buffPtr input: A pointer to the data buffer into which the bytes are }
{ to be read. }
{***************************************************************************}
FUNCTION FSWriteNoCache (refNum: Integer;
VAR count: LongInt;
buffPtr: Ptr): OSErr;
{ Use FSReadNoCache to write any number of bytes to an open file while }
{ asking the file system to bypass its cache mechanism. }
{ }
{ refNum input: The file reference number of an open file. }
{ count input: The number of bytes to write to the file. }
{ output: The number of bytes actually written. }
{ buffPtr input: A pointer to the data buffer from which the bytes are }
{ to be written. }
{***************************************************************************}
FUNCTION FSWriteVerify (refNum: Integer;
VAR count: LongInt;
buffPtr: Ptr): OSErr;
{ Write any number of bytes to an open file and then verify the data was }
{ written. }
{ The FSWriteVerify function writes any number of bytes to an open file }
{ and then verifies that the data was actually written to the device. }
{ }
{ refNum input: The file reference number of an open file. }
{ count input: The number of bytes to write to the file. }
{ output: The number of bytes actually written. }
{ buffPtr input: A pointer to the data buffer from which the bytes are }
{ to be written. }
{***************************************************************************}
FUNCTION CopyFork (srcRefNum: Integer;
dstRefNum: Integer;
copyBufferPtr: Ptr;
copyBufferSize: LongInt): OSErr;
{ Use CopyFork to copy all data from the source fork to the destination }
{ fork of open file forks and makes sure the destination EOF is equal }
{ to the source EOF. }
{ }
{ srcRefNum input: The source file reference number. }
{ dstRefNum input: The destination file reference number. }
{ copyBufferPtr input: Pointer to buffer to use during copy. The }
{ buffer should be at least 512-bytes minimum. }
{ The larger the buffer, the faster the copy. }
{ copyBufferSize input: The size of the copy buffer. }
{***************************************************************************}
FUNCTION GetFileLocation (refNum: Integer;
VAR vRefNum: Integer;
VAR dirID: LongInt;
fileName: StringPtr): OSErr;
{ Use GetFileLocation to get the location (volume reference number, }
{ directory ID, and fileName) of an open file. }
{ }
{ refNum input: The file reference number of an open file. }
{ vRefNum output: The volume reference number. }
{ dirID output: The parent directory ID. }
{ fileName input: Points to a buffer (minimum Str63) where the }
{ filename is to be returned or must be nil. }
{ output: The filename. }
{***************************************************************************}
FUNCTION FSpGetFileLocation (refNum: Integer;
VAR spec: FSSpec): OSErr;
{ Use FSpGetFileLocation to get the location of an open file in an }
{ FSSpec record. }
{ }
{ refNum input: The file reference number of an open file. }
{ spec output: FSSpec record containing the file name and location.}
{***************************************************************************}
FUNCTION CopyDirectoryAccess (srcVRefNum: Integer;
srcDirID: LongInt;
srcName: StringPtr;
dstVRefNum: Integer;
dstDirID: LongInt;
dstName: StringPtr): OSErr;
{ Use CopyDirectoryAccess to copy the AFP directory access privileges }
{ from one directory to another. Both directories must be on the same }
{ file server, but not necessarily on the same server volume. }
{ }
{ srcVRefNum input: Source volume specification. }
{ srcDirID input: Source directory ID. }
{ srcName input: Pointer to source directory name, or nil when }
{ srcDirID specifies the directory. }
{ dstVRefNum input: Destination volume specification. }
{ dstDirID input: Destination directory ID. }
{ dstName input: Pointer to destination directory name, or nil when }
{ dstDirID specifies the directory. }
{***************************************************************************}
FUNCTION FSpCopyDirectoryAccess ({CONST}
VAR srcSpec: FSSpec;
{CONST}
VAR dstSpec: FSSpec): OSErr;
{ Use FSpCopyDirectoryAccess to copy the AFP directory access privileges }
{ from one directory to another. Both directories must be on the same }
{ file server, but not necessarily on the same server volume. }
{ }
{ srcSpec input: An FSSpec record specifying the source directory. }
{ dstSpec input: An FSSpec record specifying the destination }
{ directory. }
{***************************************************************************}
FUNCTION HMoveRenameCompat (vRefNum: Integer;
srcDirID: LongInt;
srcName: Str255;
dstDirID: LongInt;
dstpathName: StringPtr;
copyName: StringPtr): OSErr;
{ Use HMoveRenameCompat to move a file or directory and optionally to }
{ rename it. The source and destination locations must be on the same }
{ volume. This routine works even if the volume doesn't support }
{ MoveRename. }
{ }
{ vRefNum input: Volume specification. }
{ srcDirID input: Source directory ID. }
{ srcName input: The source object name. }
{ dstDirID input: Destination directory ID. }
{ dstName input: Pointer to destination directory name, or }
{ nil when dstDirID specifies a directory. }
{ copyName input: Points to the new name if the object is to be }
{ renamed or nil if the object isn't to be renamed. }
{***************************************************************************}
FUNCTION FSpMoveRenameCompat ({CONST}
VAR srcSpec: FSSpec;
{CONST}
VAR dstSpec: FSSpec;
copyName: StringPtr): OSErr;
{ Use FSpMoveRenameCompat to move a file or directory and optionally to }
{ rename it. The source and destination locations must be on the same }
{ volume. This routine works even if the volume doesn't support }
{ MoveRename. }
{ }
{ srcSpec input: An FSSpec record specifying the source object. }
{ dstSpec input: An FSSpec record specifying the destination }
{ directory. }
{ copyName input: Points to the new name if the object is to be }
{ renamed or nil if the object isn't to be renamed. }
{***************************************************************************}
FUNCTION BuildAFPVolMountInfo (theFlags: Integer;
theNBPInterval: SignedByte;
theNBPCount: SignedByte;
theUAMType: Integer;
theZoneName: Str31;
theServerName: Str31;
theVolName: Str27;
theUserName: Str31;
theUserPassWord: Str8;
theVolPassWord: Str8;
theAFPInfo: MyAFPVolMountInfoPtr): OSErr;
{ Use BuildAFPVolMountInfo to initialize the fields of an AFPVolMountInfo }
{ record before using that record to call the VolumeMount function. }
{ }
{ theFlags input: The AFP mounting flags. 0 = normal mount; }
{ set bit 0 to inhibit greeting messages. }
{ theNBPInterval input: The interval used for VolumeMount's }
{ NBP Lookup call. 7 is a good choice. }
{ theNBPCount input: The retry count used for VolumeMount's }
{ NBP Lookup call. 5 is a good choice. }
{ theUAMType input: The user authentication method to use. }
{ theZoneName input: The AppleTalk zone name of the server. }
{ theServerName input: The AFP server name. }
{ theVolName input: The AFP volume name. }
{ theUserName input: The user name (zero length Pascal string for }
{ guest). }
{ theUserPassWord input: The user password (zero length Pascal string }
{ if no user password) }
{ theVolPassWord input: The volume password (zero length Pascal string }
{ if no volume password) }
{ theAFPInfo input: Pointer to AFPVolMountInfo record to }
{ initialize. }
{***************************************************************************}
FUNCTION RetrieveAFPVolMountInfo (theAFPInfo: AFPVolMountInfoPtr;
VAR theFlags: Integer;
VAR theUAMType: Integer;
theZoneName: StringPtr;
theServerName: StringPtr;
theVolName: StringPtr;
theUserName: StringPtr): OSErr;
{ Use RetrieveAFPVolMountInfo to retrieve the AFP mounting information }
{ returned in an AFPVolMountInfo by the GetVolMountInfo function. }
{ }
{ theAFPInfo input: Pointer to AFPVolMountInfo record that contains }
{ the AFP mounting information. }
{ theFlags output: The AFP mounting flags. 0 = normal mount; }
{ if bit 0 is set, greeting meesages were }
{ inhibited. }
{ theUAMType output: The user authentication method used. }
{ theZoneName output: The AppleTalk zone name of the server. }
{ theServerName output: The AFP server name. }
{ theVolName output: The AFP volume name. }
{ theUserName output: The user name (zero length Pascal string for }
{ guest). }
{***************************************************************************}
FUNCTION GetUGEntries (objType: Integer;
entries: UGEntryPtr;
reqEntryCount: LongInt;
VAR actEntryCount: LongInt;
VAR objID: LongInt): OSErr;
{ Use GetUGEntries to build a list of user or group entries from the }
{ local file server. }
{ }
{ objType input: The object type: -1 = group; 0 = user }
{ UGEntries input: Pointer to array of UGEntry records where the }
{ list is returned. }
{ reqEntryCount input: The number of elements in the UGEntries array. }
{ actEntryCount output: The number of entries returned. }
{ objID input: The current index position. Set to 0 to start }
{ with the first entry. }
{ output: The index position to get the next entry. Pass }
{ this value the next time you call GetUGEntries }
{ to start where you left off. }
{***************************************************************************}
IMPLEMENTATION
{ Functions to get information out of GetVolParmsInfoBuffer. }
FUNCTION isNetworkVolume (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
isNetworkVolume := (volParms.vMServerAdr <> 0);
END;
FUNCTION hasLimitFCBs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasLimitFCBs := BTST(volParms.vMAttrib, bLimitFCBs);
END;
FUNCTION hasLocalWList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasLocalWList := BTST(volParms.vMAttrib, bLocalWList);
END;
FUNCTION hasNoMiniFndr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasNoMiniFndr := BTST(volParms.vMAttrib, bNoMiniFndr);
END;
FUNCTION hasNoVNEdit (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasNoVNEdit := BTST(volParms.vMAttrib, bNoVNEdit);
END;
FUNCTION hasNoLclSync (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasNoLclSync := BTST(volParms.vMAttrib, bNoLclSync);
END;
FUNCTION hasTrshOffLine (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasTrshOffLine := BTST(volParms.vMAttrib, bTrshOffLine);
END;
FUNCTION hasNoSwitchTo (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasNoSwitchTo := BTST(volParms.vMAttrib, bNoSwitchTo);
END;
FUNCTION hasNoDeskItems (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasNoDeskItems := BTST(volParms.vMAttrib, bNoDeskItems);
END;
FUNCTION hasNoBootBlks (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasNoBootBlks := BTST(volParms.vMAttrib, bNoBootBlks);
END;
FUNCTION hasAccessCntl (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasAccessCntl := BTST(volParms.vMAttrib, bAccessCntl);
END;
FUNCTION hasNoSysDir (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasNoSysDir := BTST(volParms.vMAttrib, bNoSysDir);
END;
FUNCTION hasExtFSVol (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasExtFSVol := BTST(volParms.vMAttrib, bHasExtFSVol);
END;
FUNCTION hasOpenDeny (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasOpenDeny := BTST(volParms.vMAttrib, bHasOpenDeny);
END;
FUNCTION hasCopyFile (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasCopyFile := BTST(volParms.vMAttrib, bHasCopyFile);
END;
FUNCTION hasMoveRename (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasMoveRename := BTST(volParms.vMAttrib, bHasMoveRename);
END;
FUNCTION hasDesktopMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasDesktopMgr := BTST(volParms.vMAttrib, bHasDesktopMgr);
END;
FUNCTION hasShortName (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasShortName := BTST(volParms.vMAttrib, bHasShortName);
END;
FUNCTION hasFolderLock (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasFolderLock := BTST(volParms.vMAttrib, bHasFolderLock);
END;
FUNCTION hasPersonalAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasPersonalAccessPrivileges := BTST(volParms.vMAttrib, bHasPersonalAccessPrivileges);
END;
FUNCTION hasUserGroupList (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasUserGroupList := BTST(volParms.vMAttrib, bHasUserGroupList);
END;
FUNCTION hasCatSearch (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasCatSearch := BTST(volParms.vMAttrib, bHasCatSearch);
END;
FUNCTION hasFileIDs (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasFileIDs := BTST(volParms.vMAttrib, bHasFileIDs);
END;
FUNCTION hasBTreeMgr (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasBTreeMgr := BTST(volParms.vMAttrib, bHasBTreeMgr);
END;
FUNCTION hasBlankAccessPrivileges (VAR volParms: GetVolParmsInfoBuffer): Boolean;
BEGIN
hasBlankAccessPrivileges := BTST(volParms.vMAttrib, bHasBlankAccessPrivileges);
END;
END.